import React, { Component } from 'react'
import { getSwiperList } from '../../api/home'
import { Carousel, WingBlank } from 'antd-mobile'

export default class Homes extends Component {
    state = {
        list: [],
        data: ['1', '2', '3'],
        imgHeight: 176
    }
    render() {
        const { list } = this.state
        return (
            <div className="h100">
                {/* 轮播图 */}
                <div>
                    <WingBlank>
                        <Carousel autoplay={false}>
                            { list.map(val => (
                                    <img
                                        key = { val.goods_id }
                                        src={ val.image_src }
                                        alt=""
                                        style={{ width: '100%', verticalAlign: 'top' }}
                                    />
                            )) }
                        </Carousel>
                    </WingBlank>
                </div>
            </div>
        )
    }
    componentDidMount() {
        getSwiperList().then(res => {
            this.setState({
                list: res.data.message
            })
        })
    }
}
